﻿using SqlSugar;
using System;
using System.Collections.Generic;
using WCS.Helpers.PLCOperation;

namespace WCS.Entity
{
    /// <summary>
    /// PLC类
    /// </summary>
    [SugarTable("Wcs_Dev_Plc")]
    public class WcsDevPlc
    {
        /// <summary>
        /// IP地址
        /// </summary>
        public string Ip { get; set; }

        /// <summary>
        /// 端口
        /// </summary>
        public string Port { get; set; }

        /// <summary>
        /// PLC类型
        /// </summary>
        public string Plc_Type { get; set; }

        /// <summary>
        /// 读取块
        /// </summary>
        public string Read_Block { get; set; }

        /// <summary>
        /// 写入块
        /// </summary>
        public string Write_Block { get; set; }

        /// <summary>
        /// 读取长度
        /// </summary>
        public int Read_Length { get; set; }

        /// <summary>
        /// 设备编码
        /// </summary>
        public string Dev_Code { get; set; }

        /// <summary>
        /// 设备名称
        /// </summary>
        public string PLC_Name { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string Dev_Type { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string SENDTASKCODE { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string Enable { get; set; }

        /// <summary>
        /// plc报警信息
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string ATTRIBUTE1 { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string ATTRIBUTE2 { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string ATTRIBUTE3 { get; set; }

        /// <summary>
        /// 设备类型
        /// </summary>
        public string ATTRIBUTE4 { get; set; }

        /// <summary>
        /// PLC链接对象
        /// </summary>
        public S7Plc S7Plc = null;

        ///写入PLC站台类 
        public WcsDevStation WritePlcManager = new WcsDevStation();

        /// <summary>
        /// 输送线站台集合
        /// </summary>
        public List<ConveyorStation> conveyStations = new List<ConveyorStation>();
        /// <summary>
        /// 输送线站台
        /// </summary>
        public ConveyorStation conveyStation = new ConveyorStation();


        public List<WcsReadTrayCode> wcsReadTrayCode = new List<WcsReadTrayCode>();

        /// <summary>
        /// 堆垛机站台
        /// </summary>
        public StackerStation stackerStation = new StackerStation();
    }

    /// <summary>
    /// 设备类型枚举
    /// </summary>
    public enum Dev_Type
    {
        RGV = 1,
        Convey = 2,
        Stacker = 3,
        PSS = 4,
        AGV = 5,
    }

    /// <summary>
    /// PLC通讯协议类型
    /// </summary>
    public enum PlcContentType
    {
        S7 = 1,
        OPCUA = 2,
    }
}
